﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/RopaOnline.Master" AutoEventWireup="true"
    CodeBehind="OrderSearch.aspx.cs" Inherits="Upsam.RopaOnline.Web.OrderSearch" %>

<asp:Content ID="cntHead" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="cntContext" ContentPlaceHolderID="cphContext" runat="server">
    <div>
        <fieldset style="width: 98%; float: left; margin-top: 10px;">
            <legend>Búsqueda Pedido</legend>
            <div style="width: 98%; float: left; margin-top: 10px;">
                <div style="width: 48%; float: left; padding-left: 10px;">
                    <asp:Label ID="lblEmisionDate" runat="server" Text="Fecha Emision" AssociatedControlID="txtEmisionDate"></asp:Label>
                </div>
                <div style="width: 48%; float: left; padding-left: 10px;">
                    <asp:TextBox ID="txtEmisionDate" runat="server" Width="98%"></asp:TextBox>
                </div>
                <div style="width: 48%; float: left; padding-left: 10px;">
                    <asp:Label ID="lblDeliveryDate" runat="server" Text="Fecha Entrega" AssociatedControlID="txtDeliveryDate"></asp:Label>
                </div>
                <div style="width: 48%; float: left; padding-left: 10px;">
                    <asp:TextBox ID="txtDeliveryDate" runat="server" Width="98%"></asp:TextBox>
                </div>
                <div style="width: 48%; float: left; padding-left: 10px;">
                    <asp:Label ID="lblTotal" runat="server" Text="Total Pedido" AssociatedControlID="txtTotal"></asp:Label>
                </div>
                <div style="width: 48%; float: left; padding-left: 10px;">
                    <asp:TextBox ID="txtTotal" runat="server" Width="98%"></asp:TextBox>
                </div>
                <div style="width: 48%; float: left; padding-left: 10px;">
                    <asp:Label ID="lblSend" runat="server" Text="Envio" AssociatedControlID="txtSend"></asp:Label>
                </div>
                <div style="width: 48%; float: left; padding-left: 10px;">
                    <asp:TextBox ID="txtSend" runat="server" Width="98%"></asp:TextBox>
                </div>
            </div>
            <div style="width: 98%; float: left; margin-top: 10px; text-align: center; margin-bottom: 10px;">
                <asp:Button ID="btnSearch" runat="server" Text="Buscar" OnClick="btnSearch_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnAdd" runat="server" Text="Agregar" OnClick="btnAdd_Click" />
            </div>
        </fieldset>
        <div style="width: 98%; float: left; height: auto; margin-top: 10px;">
            <div style="width: 98%; float: left; margin-bottom: 10px;">
                Resultado</div>
            <asp:GridView ID="grvOrder" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                DataKeyNames="IdPedido" DataSourceID="ldsOrder" GridLines="Horizontal">
                <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                <Columns>
                <asp:ButtonField ButtonType="Link" CommandName="EditItem" CausesValidation="false"
						Text="Editar" />
                    <asp:CommandField ShowDeleteButton="True" />
                    <asp:BoundField DataField="IdPedido" HeaderText="IdPedido" 
                        InsertVisible="False" ReadOnly="True" SortExpression="IdPedido" />
                    <asp:BoundField DataField="IdUsuario" HeaderText="IdUsuario" 
                        SortExpression="IdUsuario" />
                    <asp:BoundField DataField="IdDireccion" HeaderText="IdDireccion" 
                        SortExpression="IdDireccion" />
                    <asp:BoundField DataField="IdPedioProducto" HeaderText="IdPedioProducto" 
                        SortExpression="IdPedioProducto" />
                    <asp:BoundField DataField="FechaEmision" HeaderText="FechaEmision" 
                        SortExpression="FechaEmision" />
                    <asp:BoundField DataField="FechaEntrega" HeaderText="FechaEntrega" 
                        SortExpression="FechaEntrega" />
                    <asp:BoundField DataField="Total" HeaderText="Total" SortExpression="Total" />
                    <asp:BoundField DataField="IdTipoPago" HeaderText="IdTipoPago" 
                        SortExpression="IdTipoPago" />
                    <asp:BoundField DataField="IdEmpresaEnvio" HeaderText="IdEmpresaEnvio" 
                        SortExpression="IdEmpresaEnvio" />
                    <asp:BoundField DataField="FechaEnvio" HeaderText="FechaEnvio" 
                        SortExpression="FechaEnvio" />
                </Columns>
                <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                <AlternatingRowStyle BackColor="#F7F7F7" />
            </asp:GridView> 
            <asp:LinqDataSource ID="ldsOrder" runat="server" 
                ContextTypeName="Upsam.RopaOnline.Modelo.Data.RopaOnLineDataContext" 
                EnableDelete="True" OrderBy="FechaEmision" TableName="Pedidos" 
                Where="((@FechaEmision == null || FechaEmision.Equals(@FechaEmision))) &amp;&amp; ((@FechaEntrega == null || FechaEntrega.Equals(@FechaEntrega)) &amp;&amp; ((@FechaEnvio == null || FechaEnvio.Equals(@FechaEnvio)) &amp;&amp; (@Total.Equals(string.Empty) || Total.Contains(@Total)))">
                <WhereParameters>
                    <asp:ControlParameter ControlID="txtEmisionDate" Name="FechaEmision" 
                        PropertyName="Text" Type="DateTime" />
                    <asp:ControlParameter ControlID="txtDeliveryDate" Name="FechaEntrega" 
                        PropertyName="Text" Type="DateTime" />
                    <asp:ControlParameter ControlID="txtSend" Name="FechaEnvio" PropertyName="Text" 
                        Type="DateTime" />
                    <asp:ControlParameter ControlID="txtTotal" Name="Total" PropertyName="Text" 
                        Type="Decimal" />
                </WhereParameters>
            </asp:LinqDataSource>
        </div>
    </div>
</asp:Content>
